<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<script>
  function page(n,s){
    $("#pageNo").val(n);
    $("#pageSize").val(s);
    $("#billInfo").submit();
    return false;
  }

  function billInfoPrint() {
      var payments = $("#prepayments").val();
      var visitId = $("#visitId").val();
      var visitNo = $("#visitNo").val();
      if(payments=='undefined'){
          payments= 0;
      }else{
          printPdf('${ctx}/nurse/searchBillPrint', 'visitId='+visitId+'&patVisit.visitNo='+visitNo+'&prepayments='+payments);
      }
  }

    $(function(){
        $(':checkbox[type="checkbox"]').each(function(){
            $(this).click(function(){
                if($(this).attr('checked')){
                    $(':checkbox[type="checkbox"]').removeAttr('checked');
                    $(this).attr('checked','checked');
                }
            });
        });
    });

</script>
<div class="content-wrap">
    <div class="wrapper" style="bottom: 50px;">
        <ul class="nav nav-tabs">
            <li><a href="#" onclick="loadDiv('mainCenterDiv','${ctx}/nurse/index')">床位列表</a></li>
            <li >
                <a href="#" onclick="loadDiv('mainCenterDiv','${ctx}/orders/orders/feeOper?patientId=${patVisit.patientId}&visitId=${patVisit.id}')">费用补录</a>
            </li>
            <li class="active">
                <a href="#"  onclick="loadDiv('mainCenterDiv','${ctx}/nurse/searchBill?visitId=${patVisit.id}')">查询费用信息</a>
            </li>
        </ul>
        <section class="panel panel-default">
            <div class="panel-body">
                <div class="table-responsive no-border">
                    <form:form data-parsley-validate=""  id="billInfo" modelAttribute="inpBillDetail"
                               onsubmit="return loadDivForm('mainCenterDiv','billInfo','${ctx}/nurse/searchBill');" method="post">
                        <div class="form-group">
                            <label class="col-sm-1 control-label">住院号：</label>
                            <div class="col-sm-2">
                                <input type="text" name="visitNo" id="visitNo" class="form-control" value="${patVisit.visitNo}"  disabled="true">
                            </div>
                            <label class="col-sm-1 control-label">预交金：</label>
                            <div class="col-sm-2">
                                <input type="text" name="prepayments" id="prepayments" class="form-control" value="${patVisit.prepayments}"  disabled="true">
                            </div>

                            <label class="col-sm-1 control-label">姓名：</label>
                            <div class="col-sm-2">
                                <input type="text" name="name" class="form-control" value="${patVisit.patVisitIndex.name}"  disabled="true">
                            </div>

                        </div>
                        <div class="form-group">
                            <label class="col-sm-1 control-label">开始日期：</label>
                            <div class="col-sm-2">
                                <input name="startTime" value="${inpBillDetail.startTime}" class="form-control Wdate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});">
                            </div>

                            <label class="col-sm-1 control-label">合计费用：</label>
                            <div class="col-sm-2">
                                <input type="text" name="totalChages" class="form-control" value="${patVisit.price}"  disabled="true">
                            </div>

                            <label class="col-sm-1 control-label">年龄：</label>
                            <div class="col-sm-2">
                                <input type="text" name="age" class="form-control" value="${patVisit.patVisitIndex.age}"  disabled="true">
                            </div>

                            <label class="col-sm-1 control-label">入院日期：</label>
                            <div class="col-sm-2">
                                <input type="text" name="admissionDate" class="form-control" value="<fmt:formatDate value="${patVisit.admissionDate}" pattern="yyyy-MM-dd"></fmt:formatDate>"  disabled="true">
                            </div>
                            <label class="col-sm-1 control-label">结束日期：</label>
                            <div class="col-sm-2">
                                <input name="endTime" value="${inpBillDetail.endTime}" class="form-control Wdate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});">
                            </div>
                        </div>
                        <div class="col-sm-3">
                            <label class="col-sm-3 control-label"><input  type="radio"  name="repeatIncaditor" value="1" />长期 </label>
                            <label class="col-sm-3 control-label"><input  type="radio" name="repeatIncaditor" value="2" />临时 </label>
                        </div>
                        <div class="col-sm-3">
                            <input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
                            <input  class="btn btn-primary" type="button" onclick="billInfoPrint()" value="打印"/>
                        </div>
                    </form:form>
                    <div class="datatable-top">
                        <div class="pull-left">
                            <form:form id="billInfo" modelAttribute="inpBillDetail"
                                       onsubmit="return loadDivForm('mainCenterDiv','billInfo','${ctx}/nurse/searchBill');"
                                       method="post" class="form-inline">
                                <form:hidden path="patientId"/>
                                <form:hidden path="visitId"/>

                                <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
                                <input id="pageSize" name="pageSize" type="hidden"
                                       value="${page.pageSize}"/>
                                <%-- <input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
                                 <input  class="btn btn-primary" type="button" onclick="billInfoPrint()" value="打印"/>--%>
                            </form:form>
                        </div>
                    </div>
                    <table id="contentTable" class="table table-bordered mg-t datatable">
                        <thead>
                        <tr>
                            <th>项目名称</th>
                            <th>数量</th>
                            <th>单价</th>
                            <th>计价金额</th>
                            <th>应收费用</th>
                            <th>计价日期</th>
                            <th>计价员</th>
                            <th>开单科室</th>
                            <th>执行科室</th>
                        </tr>
                        </thead>
                        <tbody>
                        <c:forEach items="${page.list}" var="billDetail">
                            <tr>
                                <td>${billDetail.itemName}</td>
                                <td>${billDetail.amount}</td>
                                <td>${billDetail.itemPrice}</td>
                                <td>${billDetail.costs}</td>
                                <td>${billDetail.charges}</td>
                                <td><fmt:formatDate value="${billDetail.createDate}" pattern="yyyy-MM-dd "></fmt:formatDate></td>
                                <td>${billDetail.user.name}</td>
                                <td>${fns:getDeptName(billDetail.orderDept,'')}</td>
                                <td>${fns:getDeptName(billDetail.performDept,'')}</td>
                                <c:set var="totalCharges" value="${billDetail.charges+totalCharges}"></c:set>
                            </tr>
                        </c:forEach>
                        </tbody>
                    </table>
                    <div class="pagination">${page}</div>
                </div>
            </div>
        </section>
    </div>
</div>
